home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_03 / stout / circbuf.h < prev    next >
C/C++ Source or Header  |  1994-12-08  |  666b  |  37 lines

  1. /*
  2. **  CIRCBUF.H - Header file for circular buffer C functions
  3. */
  4.  
  5. #ifndef _CIRCBUF_DEFINED_
  6. #define _CIRCBUF_DEFINED_
  7.  
  8. typedef enum {CSIZ_TINY = 4, CSIZ_SMALL = 6, CSIZ_MEDIUM = 10,
  9.               CSIZ_LARGE = 18, CSIZ_HUGE = 34} CSIZE;
  10.  
  11. typedef enum {FALSE, TRUE} LOGICAL;
  12.  
  13. typedef struct {
  14.       CSIZE    len;
  15.       size_t   next;
  16.       LOGICAL  full;
  17.       short   *buf;
  18. } CBUF;
  19.  
  20. CBUF    *cbuf_malloc(CSIZE);
  21. LOGICAL  cbuf_add(CBUF *, short);
  22.  
  23. short    OlympicFilt(CBUF *);
  24. short    AverageFilt(CBUF *);
  25.  
  26. #ifndef MAX
  27.  #define MAX(a,b) (((a) > (b)) ? (a) : (b))
  28. #endif
  29.  
  30. #ifndef MIN
  31.  #define MIN(a,b) (((a) < (b)) ? (a) : (b))
  32. #endif
  33.  
  34. #endif // _CIRCBUF_DEFINED_
  35.  
  36.  
  37.